//
// Description: 
// Created by Loading on 2021/9/12.
//

#include <bits/stdc++.h>

using namespace std;

long long interchangeableRectangles(vector<vector<int>> &rectangles) {
    long long res = 0;
    unordered_map<double, long long> m;
    for (auto &v : rectangles) {
        m[v[0] / (double) v[1]]++;
    }

    for (auto &it : m) {
        res += it.second * (it.second - 1) / 2;
    }

    return res;
}

int main() {
    vector<vector<int>> rectangles = {{4,  8},
                                      {3,  6},
                                      {10, 20},
                                      {15, 30}};
    long long res = interchangeableRectangles(rectangles);
    cout << res << endl;

    return 0;
}